import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/home/Home.vue'
import Login from '@/views/login/Login.vue'
import Page from '@/views/page/Page.vue'
import pageDetail from '@/views/page/pageDetail.vue'
import NotFound from '@/components/NotFound'
const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return routerPush.call(this, location).catch(error => error)
}

Vue.use(VueRouter)

const SendPaySlip = () =>
	import( /* webpackChunkName: "paySlip" */ '@/views/pay-slip/SendPaySlip.vue')
const PaySlipManagement = () =>
	import( /* webpackChunkName: "paySlip" */ '@/views/pay-slip/PaySlipManagement.vue')
const PreviewPaySlip = () =>
	import( /* webpackChunkName: "paySlip" */ '@/views/pay-slip/PreviewPaySlip.vue')
const PaySlipSetting = () =>
	import( /* webpackChunkName: "paySlip" */ '@/views/pay-slip/PaySlipSetting.vue')
const Appointment = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/Appointment.vue')
const AppointmentReview = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/AppointmentReview.vue')
const AppointmentDetails = () =>
	import( /* webpackChunkName: "venueManagement" */ '@/views/venue-management/AppointmentDetails.vue')

const routes = [
	{
		path: '*',
		component: NotFound,
		name: 'Notfound',
		meta: {
			title: '404'
		}
	},
	{
		path: '/',
		redirect: '/home'
	},
	{
		path: '/home',
		name: 'Home',
		component: Home,
		meta: {
			title: '首页'
		}
	},
	{
		path: '/login',
		name: 'Login',
		component: Login,
		meta: {
			title: '登录'
		}
	},
	{
		path: '/page',
		name: 'Page',
		component: Page,
		meta: {
			title: '表格'
		}
	},
	{
		path: '/page/pageDetail',
		name: 'pageDetail',
		component: pageDetail,
		meta: {
			title: '表格详情'
		}
	},
	{
		path: '/appointment',
		name: 'Appointment',
		component: Appointment,
		meta: {
			title: '场馆预约',
			requiresAuth: true
		}
	},
	{
		path: '/appointmentReview',
		name: 'AppointmentReview',
		component: AppointmentReview,
		meta: {
			title: '预约审核',
			requiresAuth: true
		}
	},
	{
		path: '/appointmentDetails',
		name: 'AppointmentDetails',
		component: AppointmentDetails,
		meta: {
			title: '预约详情',
			requiresAuth: true
		},
	},
]

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})

export default router